package com.huifaapp.mall.adapter.adapter2;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.huifaapp.mall.R;
import com.huifaapp.mall.bean.Huishengqian.Helplist;
import com.huifaapp.mall.view.RoundImageView;
import com.jcodecraeer.xrecyclerview.XRecyclerView;

import java.util.List;

/**
 * @desc
 * @auth Mr Wu Fan
 * Created by you on 2018/3/22.
 */

public class Zhuliadapter extends XRecyclerView.Adapter<Zhuliadapter.viewhoder>{
        private Context context;
   private  List<Helplist.DataBean.ListBean> list;

    public Zhuliadapter(Context context, List<Helplist.DataBean.ListBean> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public viewhoder onCreateViewHolder(ViewGroup parent, int viewType) {
        View inflate = View.inflate(context, R.layout.zhuli, null);
        viewhoder viewhoder = new viewhoder(inflate);
        return viewhoder;
    }

    @Override
    public void onBindViewHolder(viewhoder holder, int position) {
        Glide.with(context).load(list.get(position).getHeadImg()).into(holder.roundImageView);
        holder.tvmoney.setText(list.get(position).getRate()+"");
        holder.tvname.setText(list.get(position).getName());
        holder.tvtimeto.setText(list.get(position).getCreateTime());

    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    class  viewhoder extends XRecyclerView.ViewHolder{
        RoundImageView roundImageView;
        TextView tvname;
        TextView  tvtimeto;
        TextView tvmoney;

        public viewhoder(View itemView) {
            super(itemView);
            roundImageView = (RoundImageView) itemView.findViewById(R.id.headimag);
            tvname = (TextView) itemView.findViewById(R.id.name);
            tvtimeto = (TextView) itemView.findViewById(R.id.timetwo);
            tvmoney = (TextView) itemView.findViewById(R.id.tvmoney);
        }
    }
}
